package com.jianger.dao;


import com.jianger.pojo.SessionAggrStat;
import com.jianger.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;
/**
 * @author jianger
 * @ date  2018/4/2-23:34
 * @project com.spark.daoImpl
 */
public class SessionAggrStatDAOImpl implements ISessionAggrStatDAO {


    /**
     * 插入session聚合统计结果
     * @param sessionAggrStat
     */
    @Override
    public void save(SessionAggrStat sessionAggrStat) throws SQLException {

            String sql = "insert into session_aggr_stat "
                    + "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
            Object[] params = new Object[]{sessionAggrStat.getTask_id(),
                    sessionAggrStat.getSession_count(),
                    sessionAggrStat.getS1_s3(),
                    sessionAggrStat.getS4_s6(),
                    sessionAggrStat.getS7_s9(),
                    sessionAggrStat.getS10_s30(),
                    sessionAggrStat.getS30_s60(),
                    sessionAggrStat.getM1_m3(),
                    sessionAggrStat.getM3_m10(),
                    sessionAggrStat.getM10_m30(),
                    sessionAggrStat.getM30(),
                    sessionAggrStat.getV1_3(),
                    sessionAggrStat.getV4_6(),
                    sessionAggrStat.getV7_9(),
                    sessionAggrStat.getV10_30(),
                    sessionAggrStat.getV30_60(),
                    sessionAggrStat.getV60()};
        QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
        qr.update(sql,params);
        }
    }

